-- ================================================
-- Template generated from Template Explorer using:
-- Create Procedure (New Menu).SQL
--
-- Use the Specify Values for Template Parameters 
-- command (Ctrl-Shift-M) to fill in the parameter 
-- values below.
--
-- This block of comments will not be included in
-- the definition of the procedure.
-- ================================================
USE [WarehouseManagement]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		TuyenVD
-- Create date: 3/16/2011
-- Description:	This stored procedure use to get all Employee records
-- =============================================
ALTER PROCEDURE [GetCollectionEmployee]
(
@IsShowAll bit=0
)
AS
BEGIN
	SELECT 
			e.[EmployeeID]
			, e.[FullName]
			, e.[DateOfBirth]
			, e.[IdentityCardNumber]
			, e.[Email]
			, e.[Gender]
			, e.[JoinedDate]
			, e.[Address]
			, e.IsDelete
			, e.[PhoneNumber]
			, e.[MobileNumber]
			, e.[Description]
			, et.[EmploymentTypeID]
			, et.[EmploymentType]
			, r.[RoleID]
			, r.[RoleName]
			, e.[Username]
	FROM 
			[Employee] e
	INNER JOIN 
			[EmploymentType] et
	ON 
			e.[EmploymentTypeID] = et.[EmploymentTypeID]
	INNER JOIN
			[Role] r
	ON 
			r.[RoleID] = e.[RoleID]
	WHERE 
			(e.[IsDelete] = 0 OR e.[IsDelete] = @IsShowAll)
			AND e.UserName <> 'admin'
END

GO

/*
USE WarehouseManagement
GO
SELECT * FROM MATERIAL
EXEC [GetCollectionMaterialType] 
*/
